﻿@model StockQuoteWebSite.Models.StockModel

@{
    ViewBag.Title = "Stock Quotes";
}

<div class="row">
    <div class="col-md-7">
        <h1>Stock Quotes</h1>
    </div>
    <div class="col-md-5">
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <div class="form-inline form-centered">
            <div class="form-group">
                @Html.TextBoxFor(
                m => m.TickerSymbol,
                new
                {
                    @class = "form-control input-wide",
                    placeholder = "Type a ticker symbol.  Stuck?  Try 'GOOG'",
                    autofocus = "autofocus"
                })               
            </div>
            <button type="button" id="QuoteButton" class="btn btn-default">Get Quote</button>
            <img src="@Url.Content("~/Content/Images/ajax-loader.gif")" id="LoadingAnimation" alt="Loading..." style="display: none;" />
            
        </div>
        
    </div>
    <div class="row">
        <div class="col-md-12" id="QuoteError" style="text-align: center; margin-top: 5px; display: none;">
            <small style="color: red;">Oops!  Your ticker symbol is invalid or you may be requesting quotes too quickly!</small>
        </div>
    </div>
</div>

<div id="ChartSection" style="margin-top: 30px;">
    @if (Model != null)
    {
        Html.Partial("_StockData", @Model, new ViewDataDictionary(Html.ViewDataContainer.ViewData)
        {
            TemplateInfo = new TemplateInfo { HtmlFieldPrefix = "StockChart" }
        });
    }
</div>

@section Scripts{
    <script src="@Url.Content("~/Content/Scripts/Quote.js")"></script>
}